home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1997 #3 / Amiga Plus CD - 1997 - No. 03.iso / pd / demo-versionen / maxoncpp4-demo / demo / supercode / loc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-01  |  1.3 KB  |  75 lines

  1. //-------------------------------------
  2. //
  3. // SuperCode (c) 1996 by T.Kühn 
  4. //
  5. // Programmiersprache:    ANSI-C
  6. // Projektstart:            28.8.94
  7. //
  8. // Modul:                Locale.c
  9. //
  10. //-------------------------------------
  11.  
  12. /*-------------------------------------
  13. void loc_init(char *CatName,char *language);
  14. void loc_free();
  15. char *CatStr(LONG StrNum);
  16. -------------------------------------*/
  17.  
  18.  
  19. #include <libraries/locale.h>
  20. #include <pragma/locale_lib.h>
  21.  
  22. #define CATCOMP_ARRAY
  23. #include <Struct.h>
  24.  
  25.  
  26. //-------------------------------------
  27.  
  28. struct Catalog *SysCat=0;
  29. struct Locale *locale=0;
  30.  
  31. UBYTE CatName[]="supercode.catalog";
  32.  
  33. //-------------------------------------
  34. VOID loc_init(char *language)
  35. {
  36.     if (LocaleBase)
  37.     {
  38.         locale=OpenLocale(0);
  39.         if (SysCat) CloseCatalog(SysCat);
  40.         SysCat=OpenCatalog(locale,CatName,OC_Language,language,TAG_END);
  41.     }
  42. }
  43. //-------------------------------------
  44. VOID loc_free()
  45. {
  46.     if (SysCat)
  47.     {
  48.         CloseCatalog(SysCat);
  49.         SysCat=0;
  50.     }
  51.     if (locale)
  52.     {
  53.         CloseLocale(locale);
  54.         locale=0;
  55.     }
  56. }
  57. //-------------------------------------
  58. char *CatStr(LONG StrNum)
  59. {
  60.     const struct CatCompArrayType *arr=&CatCompArray[0];
  61.     char *Str;
  62.  
  63.     while (StrNum!=arr->cca_ID)
  64.     {
  65.         arr++;
  66.     }
  67.     Str = arr->cca_Str;
  68.  
  69.     if (LocaleBase) Str=GetCatalogStr(SysCat,StrNum,Str);
  70.  
  71.     return Str;
  72. }
  73. //-------------------------------------
  74.  
  75.